﻿<phone:PhoneApplicationPage 
	x:Class="WinMilk.Gui.AuthPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:con="clr-namespace:WinMilk.Gui.Controls"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True"
    DataContext="{Binding RelativeSource={RelativeSource Self}}"
    Loaded="PhoneApplicationPage_Loaded"
    con:TiltEffect.IsTiltEnabled="True">
    
    <phone:PhoneApplicationPage.Resources>

        

    </phone:PhoneApplicationPage.Resources>

	<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneBackgroundBrush}">
		<Grid.RowDefinitions>
			<RowDefinition Height="44"/>
			<RowDefinition Height="724*"/>
		</Grid.RowDefinitions>

		<!--This is the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Margin="12,17,0,0">
            <TextBlock x:Name="ApplicationTitle" Text="{Binding Path=Loc.AuthPageTitle, Source={StaticResource L10N}}" Style="{StaticResource PhoneTextNormalStyle}"/>
        </StackPanel>

        <Grid x:Name="ContentGrid" Grid.Row="1">
            <!-- content goes here -->

            <StackPanel Name="AskAccount">

                <TextBlock TextWrapping="Wrap" Text="{Binding Path=Loc.AuthPageAskAccountLine1, Source={StaticResource L10N}}" FontSize="{StaticResource PhoneFontSizeLarge}" Margin="{StaticResource PhoneTouchTargetOverhang}" />
                <TextBlock TextWrapping="Wrap" Text="{Binding Path=Loc.AuthPageAskAccountLine2, Source={StaticResource L10N}}" FontSize="{StaticResource PhoneFontSizeLarge}" Margin="{StaticResource PhoneTouchTargetOverhang}" />
                <TextBlock TextWrapping="Wrap" Text="{Binding Path=Loc.AuthPageAskAccountLine3, Source={StaticResource L10N}}" FontSize="{StaticResource PhoneFontSizeLarge}" Margin="{StaticResource PhoneTouchTargetOverhang}" />

                <Grid Margin="{StaticResource PhoneTouchTargetOverhang}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Button Content="{Binding Path=Loc.AuthPageAskAccountYesButton, Source={StaticResource L10N}}" Grid.Column="0" Name="YesAccountButton" Click="YesAccountButton_Click" />
                    <Button Content="{Binding Path=Loc.AuthPageAskAccountNoButton, Source={StaticResource L10N}}" Grid.Column="1" Name="NoAccountButton" Click="NoAccountButton_Click" />
                </Grid>

            </StackPanel>

            <Grid Name="AuthBrowser" Visibility="Collapsed">
                <Grid.RowDefinitions>
                    <RowDefinition Height="10"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <ProgressBar IsIndeterminate="{Binding IsLoading}" 
                         Visibility="{Binding IsLoading, Converter={StaticResource VisibilityConverter}}"  
                         Style="{StaticResource PerformanceProgressBar}" />

                <phone:WebBrowser Name="webBrowser1" Grid.Row="1" Navigating="webBrowser1_Navigating" Navigated="webBrowser1_Navigated"/>

                <Grid Grid.Row="2">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                    <TextBlock TextWrapping="Wrap" VerticalAlignment="Center" Name="AuthStatus" 
                           Text="{Binding Path=Loc.AuthInstructions, Source={StaticResource L10N}}" Margin="12,13,0,13" Grid.ColumnSpan="2" />
                    <con:IconButton Text="{Binding Path=Loc.AuthDoneButton, Source={StaticResource L10N}}" Type="check" Click="AuthDoneButton_Click" Grid.Column="1" Grid.Row="1"/>
                    <con:IconButton Text="{Binding Path=Loc.AuthRetryButton, Source={StaticResource L10N}}" Type="refresh" Click="RetryButton_Click" Grid.Column="0" Grid.Row="1"/>
                </Grid>
            </Grid>

            <Grid Name="CreateAccountBrowser" Visibility="Collapsed">
                <Grid.RowDefinitions>
                    <RowDefinition Height="10"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <ProgressBar IsIndeterminate="{Binding IsLoading}" 
                         Visibility="{Binding IsLoading, Converter={StaticResource VisibilityConverter}}"  
                         Style="{StaticResource PerformanceProgressBar}" />

                <phone:WebBrowser Name="AccountBrowser" Grid.Row="1" Navigating="webBrowser1_Navigating" Navigated="webBrowser1_Navigated"/>

                <Grid Grid.Row="2">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                    <TextBlock TextWrapping="Wrap" VerticalAlignment="Center" Name="CreateStatus" 
                           Text="{Binding Path=Loc.AuthCreateInstructions, Source={StaticResource L10N}}" Margin="12,13,0,13" Grid.ColumnSpan="2" />
                    <con:IconButton Text="{Binding Path=Loc.AuthContinueButton, Source={StaticResource L10N}}" Type="next" Click="CreateDoneButton_Click" Grid.Column="1" Grid.Row="1"/>
                    <con:IconButton Text="{Binding Path=Loc.AuthRetryButton, Source={StaticResource L10N}}" Type="refresh" Click="CreateRetryButton_Click" Grid.Column="0" Grid.Row="1"/>
                </Grid>
            </Grid>

        </Grid>

        

    </Grid>
</phone:PhoneApplicationPage>